// 1.1 自定义插件
// export plugin object
import SvgIcon from '@/components/SvgIcon/index.vue'
// import plugin-icons
import * as ElementPlusIconsVue from '@element-plus/icons-vue'

// d对外暴露插件对象 , 分隔多个组件
const globalComponent = { SvgIcon }
// Object.keys(globalComponent).forEach(key => app.component(key, globalComponent[key]));
export default {
  // 1.1 务必叫做install方法
  install(app) {
    // 2.1 注册全局组件
    Object.keys(globalComponent).forEach((key) =>
      app.component(key, globalComponent[key]),
    )
    // 2.2 register icons
    for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
      app.component(key, component)
    }
    console.log(ElementPlusIconsVue);
    
    console.log('global plugin init')
  },
}
